package edu.washington.cs.workflow.analysis.guistructure;

import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;

import org.uispec4j.Panel;

import edu.washington.cs.workflow.util.Utils;

public class NormalExecution implements SequenceExecutionOutcome {

	public final Collection<Panel> activePanels;
	
	public NormalExecution() {
		this(Collections.<Panel>emptyList());
	}
	
	//only used in replay
	public static NormalExecution makeNormalExecution(Collection<Panel> panels) {
		return new NormalExecution(panels);
	}
	
	private NormalExecution(Collection<Panel> panels) {
		Utils.checkNotNull(panels);
		activePanels = new LinkedList<Panel>();
		activePanels.addAll(panels);
	}
	
	@Override
	public String getOutcome() {
		return "Normal execution finishes.";
	}

	@Override
	public Collection<Panel> getActivePanels() {
		return activePanels;
	}

	@Override
	public Throwable getException() {
		return null;
	}

}
